﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CosmosKernel1
{
    class lines
    {
        public static void hline(uint x, uint y, uint z, uint c)
        {
            Cosmos.Hardware.VGAScreen screen = new Cosmos.Hardware.VGAScreen();
            while (x != z)
            {
                screen.SetPixel320x200x8(x, y, c);
                if (z > x)
                    x = x + 1;
                if (z < x)
                    y = y - 1;
            }
        }
        public static void vline(uint x, uint y, uint z, uint c)
        {
            Cosmos.Hardware.VGAScreen screen = new Cosmos.Hardware.VGAScreen();
            while (y != z)
            {
                screen.SetPixel320x200x8(x, y, c);
                if (z > y)
                    y = y + 1;
                if (z < y)
                    y = y - 1;
            }
        }
        public static void pixel(uint x, uint y, uint c)
        {
            Cosmos.Hardware.VGAScreen screen = new Cosmos.Hardware.VGAScreen();
            screen.SetPixel320x200x8(x, y, c);
        }
        public static void rectangle(uint x, uint y, uint z, uint t, uint c)
        {
            hline(x, y, z, c);
            hline(x, t, z, c);
            vline(x, y, t, c);
            vline(z, y, (t + 1), c);
        }
  
        public static void BRdiag(uint x, uint y, uint z, uint c)
        {
            uint count = 0;
            while (count <= z)
            {
                count = count + 1;
                pixel(x, y, c);
                x = x + 1;
                y = y + 1;
            }
        }
        public static void TRdiag(uint x, uint y, uint z, uint c)
        {
            uint count = 0;
            while (count <= z)
            {
                count = count + 1;
                pixel(x, y, c);
                x = x + 1;
                y = y - 1;
            }
        }
        public static void BLdiag(uint x, uint y, uint z, uint c)
        {
            uint count = 0;
            while (count <= z)
            {
                count = count + 1;
                pixel(x, y, c);
                x = x - 1;
                y = y + 1;
            }
        }
        public static void TLdiag(uint x, uint y, uint z, uint c)
        {
            uint count = 0;
            while (count <= z)
            {
                count = count + 1;
                pixel(x, y, c);
                x = x - 1;
                y = y - 1;
            }
        }
        /*   This triangle method is in developement
            public static void Itriangle(uint x, uint y, uint z, uint c)
            {
                hline(x, y, z, c);
                TRdiag(x, y, 
            }
         */
        public static void j(uint x, uint y, uint z, uint t, uint c)
        {
            hline(x, y, z, c);
            vline((z / 2), y, t, c);
            hline(x, t, (z / 2), c);
        }
        public static void a(uint x, uint y, uint z, uint t, uint c)
        {
            hline(x, y, z, c);
            hline(x, t, z, c);
            vline(x, y, t, c);
            vline(z, y, t, c);
        }
    }
}
